package com.eclipse.e0112_io.装饰者设计模式;

import java.util.ArrayList;
import java.util.List;

public class BufferedWriter extends Writer1 {
	private List<String> buf = new ArrayList<>();

	private Writer1 writer;

	public BufferedWriter(Writer1 writer) {
		this.writer = writer;
	}

	public void write(String content) {
		buf.add(content);
		if (buf.size() > 3) {
			for (String temp : buf) {
				writer.write(temp);
			}
			buf.clear();
		}
	}
}
